package com.mb.app.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.mb.app.domain.TbAboutUs;
import com.mb.app.dao.TbAboutUsMapper;
import com.mb.app.service.ITbAboutUsService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 关于我们  服务实现类
 * </p>
 *
 * @author liliping
 * @since 2019-04-01
 */
@Service
public class TbAboutUsServiceImpl extends ServiceImpl<TbAboutUsMapper, TbAboutUs> implements ITbAboutUsService {

    @Override
    public TbAboutUs getInfo() {
        return this.baseMapper.selectByIds();
    }

    @Override
    public void save(TbAboutUs tbAboutUs) {
        TbAboutUs aboutUs = this.baseMapper.selectByIds();
        if(aboutUs != null){
          aboutUs.setContent(tbAboutUs.getContent());
          aboutUs.setUpdateTime(new Date());
            this.baseMapper.updateById(aboutUs);
        }else{
            this.baseMapper.insert(tbAboutUs);
        }
    }
}
